#!/usr/bin/env python
#-*-coding:utf-8-*-

# "test.py" is part of Tarinca-COA
# (http://code.google.com/p/taringa-api/)
# Copyright (C) - 2010 Juan B Cabral <jbc dot develop at gmail dot com>

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

################################################################################
# DOCS
################################################################################

"""Test de conexion"""

################################################################################
# META
################################################################################

__version__ = "0.2"
__license__ = "LGPL3"
__author__ = "JBC"
__since__ = "0.2"
__date__ = "2010-02-03"


################################################################################
# IMPORTS
################################################################################

import unittest

import taringa
print taringa.__version__
################################################################################
# TESTS
################################################################################

class TaringaTest(unittest.TestCase):

    def setUp(self):
        key = "ee7eccf3b912e83c5b7adf3b403674c3"
        url = "http://www.taringa.net/"
        self.t = taringa.TaringaConnection(url, key)
    
    def test_call(self):
        print self.t.users_get_user_data("gab14")
        print self.t.users_get_user_data("leliel12")
        print self.t.users_get_levels()
        print self.t.users_get_posts_comments("Tamiflu")
        print self.t.users_get_posts_comments("leliel12")
        print self.t.users_get_posts_list("Tamiflu")
        print self.t.users_get_posts_list("leliel12")
        print self.t.posts_get_categories()
        print self.t.posts_get_cloud_tags()
        print self.t.site_get_site_stats()
        print self.t.posts_get_top_posts(taringa.TIME_TODAY,
                                         taringa.POST_TOP_MAX_SCORE, -1)
        print self.t.posts_get_top_users(taringa.TIME_TODAY,
                                         taringa.USER_TOP_MAX_POST, -1)            
        print self.t.posts_get_post_list(-1, 1)
        print self.t.posts_get_post_data(1963012)
        print self.t.posts_get_post_comments(1963012) 
        print self.t.posts_get_search("cristina", -1,
                                      taringa.ORDER_QUERY_DATE, "", 1)
        print self.t.posts_get_posts_tag("metal", -1,
                                         taringa.ORDER_TAG_SCORE, 1)            
        print self.t.get_rate(taringa.CALL_USERS_GET_LEVELS)

   
################################################################################
# MAIN
################################################################################

if __name__ == "__main__":
    unittest.main()


